home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / emstools.arc / EMMLIB.ARC / EMM03_B.ASM < prev    next >
Assembly Source File  |  1990-02-04  |  4KB  |  79 lines

  1. ;-----------------------------------------------------------------------------;
  2. ;      MODULE NAME:   EMM03_B.ASM                                             ;
  3. ;                                                                             ;
  4. ;    FUNCTION NAME:   get_alloc_page_count                                    ;
  5. ;                                                                             ;
  6. ;      DESCRIPTION:   This function returns the number of allocated           ;
  7. ;                     expanded memory pages.                                  ;
  8. ;                                                                             ;
  9. ;           PASSED:   &alloc_page_count:                                      ;
  10. ;                        is a far pointer to the allocated page count.        ;
  11. ;                                                                             ;
  12. ;         RETURNED:   status:                                                 ;
  13. ;                        is the status EMM returns from the call.  All other  ;
  14. ;                        returned results are valid only if the status        ;
  15. ;                        returned is zero.  Otherwise they are undefined.     ;
  16. ;                                                                             ;
  17. ;                     alloc_page_count:                                       ;
  18. ;                        is the number of expanded memory pages currently     ;
  19. ;                        unavailable (allocated).                             ;
  20. ;                                                                             ;
  21. ; C USE CONVENTION:   unsigned int status;                                    ;
  22. ;                     unsigned int alloc_page_count;                          ;
  23. ;                                                                             ;
  24. ;                     status = get_alloc_page_count (&alloc_page_count);      ;
  25. ;-----------------------------------------------------------------------------;
  26. .XLIST
  27. PAGE    60,132
  28.  
  29. IFDEF SMALL
  30.    .MODEL SMALL, C
  31. ENDIF
  32. IFDEF MEDIUM
  33.    .MODEL MEDIUM, C
  34. ENDIF
  35. IFDEF LARGE
  36.    .MODEL LARGE, C
  37. ENDIF
  38. IFDEF COMPACT
  39.    .MODEL COMPACT, C
  40. ENDIF
  41. IFDEF HUGE
  42.    .MODEL HUGE, C
  43. ENDIF
  44.  
  45. INCLUDE emmlib.equ
  46. INCLUDE emmlib.str
  47. INCLUDE emmlib.mac
  48. .LIST
  49. .CODE
  50.  
  51. get_alloc_page_count    PROC                                                  \
  52.             ptr_alloc_page_count:FAR PTR WORD
  53.  
  54.     ;---------------------------------------------------------------------;
  55.     ;   do;                                                               ;
  56.     ;   .   get total & unallocated page counts from EMM;                 ;
  57.     ;---------------------------------------------------------------------;
  58.     MOVE        AH, get_unalloc_page_cnt_fcn
  59.     INT         EMM_int
  60.  
  61.     ;---------------------------------------------------------------------;
  62.     ;   .   allocated page count = total pages - unallocated pages;       ;
  63.     ;   .   pass allocated page count back to the caller;                 ;
  64.     ;---------------------------------------------------------------------;
  65.     SUB        DX, BX
  66.     MOVE        ES:BX, ptr_alloc_page_count
  67.     MOVE        ES:[BX], DX
  68.  
  69.     ;---------------------------------------------------------------------;
  70.     ;   .   return (EMM status);                                          ;
  71.     ;   end;                                                              ;
  72.     ;---------------------------------------------------------------------;
  73.     RET_EMM_STAT    AH
  74.  
  75. get_alloc_page_count    ENDP
  76.  
  77. PAGE
  78. END
  79.